﻿using System;
using DyUi.Base.Interfaces.Services;

namespace DyUi.Core.Services
{
    public class MessageService : DyUiService, IMessageService
    {
        public Guid Subscribe(Func<String, Object, Boolean> predicate, Action<Guid, String, Object> callback)
        {
            return Controller.MessageSubSystem.SubscribeToEvent(Component, predicate, callback);
        }

        public void Publish(String eventName, Object args)
        {
            Controller.MessageSubSystem.PublishEvent(Component, eventName, args);
        }
    }
}
